<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/3/21 0021
 * Time: 17:09
 */

namespace app\home\model;

use think\Db;
use think\Model;

class IndexRecommend extends Model
{
    //获取推荐的元素
    public static  function  getYuansuIndexList($type=1,$limit=8){
        $where['type']=$type;
        $where['status']=1;
         return self::hasWhere('bindElement')->alias('a')->where($where)->order(['sort'=>'desc'])->limit($limit)->column(['a.elementId','code','title','cover','psdUrl','pngUrl']);
    }


    public function bindElement()
    {
        return $this->hasOne('Element','elementId','id','b');
    }
}